import { defineStore } from 'pinia'

export const useAppStore = defineStore('app', {
	state: () => ({
		userName: '匿名用户1',
		counter: 0,
		collapsed: false
	}),
	getters: {
		welcome: (s) => `欢迎，${s.userName}`
	},
	actions: {
		setUserName(name) {
			this.userName = name
		},
		increment() {
			this.counter++
		},
		toggleSidebar() {
			this.collapsed = !this.collapsed
		}
	}
}) 